package java3_22.Lesson;

import java.util.Scanner;

/**
 * 2：计算平均课时:输入总课时和课程数,计算平均课时.
 * 要求捕捉输入和除法错误;如果总课时少于100,抛出课时太少的错误
 */
public class Homework2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入总课时和课时数:");
        try {
            int x = scanner.nextInt();
            if (x<100){
                throw new LessonException("课时太少");
            }
            int y = scanner.nextInt();
            int z = x / y;

            System.out.println("平均课时为:"+z);
        }catch (Exception e){
            System.out.println("输入有误");
            e.printStackTrace();
        }
    }
}
